﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using System.Xml.Linq;

namespace ClassAdd
{
    class XMLParsing
    {

        XmlDocument doc = new XmlDocument();

        public void LoadXML(String pathToXML, String pathToWrite, String pathToTemplate)
        {
            doc.LoadXml(File.ReadAllText(pathToXML));
            XmlNodeList classList = doc.DocumentElement.ChildNodes;            
           
            foreach (XmlNode cList in classList)
            {                
                if (cList.Name == "class")
                {
                    ModelClassDescription modelClassDescription = new ModelClassDescription();
                    modelClassDescription.writeClass(cList.InnerText, cList.Attributes[0].Value, pathToWrite, pathToTemplate);

                    ControlClassDescription controlClassDescription = new ControlClassDescription();
                    controlClassDescription.writeClass(cList.InnerText, cList.Attributes[0].Value, pathToWrite, pathToTemplate);

                    ViewClassDescription viewClassDescription = new ViewClassDescription();
                    viewClassDescription.writeClass(cList.InnerText, cList.Attributes[0].Value, pathToWrite, pathToTemplate);
                }
            }

        }

    }
}


